package com.redrose.rxandroiddemo.gallery.util;

import android.content.ContentResolver;
import android.content.Context;
import android.database.Cursor;
import android.provider.MediaStore;
import android.util.Log;

import com.redrose.rxandroiddemo.util.ContextUtil;

public class LoadSystemPictureUtil {

    static final String TAG = "LoadSystemPictureUtil";
    public static void loadData(Context context) {
        ContentResolver contentResolver = context.getContentResolver();
        Cursor cursor = contentResolver.query(MediaStore.Images.Media.INTERNAL_CONTENT_URI, null, null, null, null);
        cursor.moveToFirst();
        while (cursor.moveToNext()){
            String name=cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.DISPLAY_NAME));
            String desc=cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.DESCRIPTION));
            String size=cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.SIZE));
            //读取图片的数据
            byte[] data=cursor.getBlob(cursor.getColumnIndex(MediaStore.Images.Media.DATA));

            String filePath=new String(data,0,data.length-1);
            Log.d(TAG, "filePath: " + filePath);
        }

    }
}
